import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:talk/pages/my/x_user_router.dart';

import '../../api/DeviceApi.dart';
import '../../commponets/ItemView.dart';
import '../../home/AppLocale.dart';
import '../../routers/fluro_navigator.dart';
import '../../tools/widgets/my_app_bar.dart';
import '../../utils/toast_utils.dart';


class UserAboutPage extends StatefulWidget {
  const UserAboutPage({
    super.key,
  });



  @override
  State<UserAboutPage> createState() => _UserAboutPageState();
}

class _UserAboutPageState extends State<UserAboutPage> {
  final DeviceApi _deviceApi = DeviceApi();

  @override
  void initState() {
    super.initState();

    // _fetchData();
  }


  Future<void> _copyToClipboard() async {

    try {
      // 使用Clipboard.setData方法复制文本
      await Clipboard.setData(
        ClipboardData(text: "https://www.uniwin-global.com"),
      );
      Toast.show("网站地址已复制到剪贴板");
    } catch (e) {
      Toast.show("复制失败：$e");
    }
  }



  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar(
        centerTitle: AppLocale.text('my_guanyuwomen'),
        backgroundColor: Colors.transparent,
        dropdownWidth: 140,
        dropdownBackgroundColor: Colors.white,
        dropdownBorderRadius: 20,
      ),


      body: Container(
          child: Column(
            children: [

              const SizedBox(height: 20,),


              ItemView(
                width: 400,
                height: 50,
                leftPadding: 10,
                rightPadding: 20,
                leftWidget: Row(
                  children: [
                    const SizedBox(width: 10),
                    Text(
                      AppLocale.text('my_appbanbenhao'),
                      style: TextStyle(
                          fontSize: 15.0,
                          color: Colors.black
                      ),
                    ),
                  ],
                ),
                rightWidget: Row(
                  children: [
                    Text(
                      '2.1',
                      style: TextStyle(
                          fontSize: 14.0,
                          color: Colors.black54
                      ),
                    ),
                  ],
                ),
                borderRadius: 8,
                onTap: () {

                },
              ),


              ItemView(
                width: 400,
                height: 50,
                leftPadding: 10,
                rightPadding: 20,
                leftWidget: Row(
                  children: [
                    const SizedBox(width: 10),
                    Text(
                      AppLocale.text('my_guanwang'),
                      style: TextStyle(
                          fontSize: 15.0,
                          color: Colors.black
                      ),
                    ),
                  ],
                ),

                rightWidget: Row(
                  children: [
                    Row(
                      children: [
                        Text(
                          'https://www.uniwin-global.com',
                          style: TextStyle(
                              fontSize: 14.0,
                              color: Colors.black54
                          ),
                        ),
                        Image.asset("images/images/deviceSetting/i1.png", width: 24),
                      ],
                    )
                  ],
                ),
                borderRadius: 8,
                onTap: () {
                  _copyToClipboard(); // 点击时调用复制方法
                },
              ),


              const SizedBox(height: 20),



              ItemView(
                width: 400,
                height: 50,
                leftPadding: 10,
                rightPadding: 20,
                leftWidget: Row(
                  children: [
                    const SizedBox(width: 10),
                    Text(
                      AppLocale.text('my_yonghushiyongxieyi'),
                      style: TextStyle(
                          fontSize: 15.0,
                          color: Colors.black
                      ),
                    ),
                  ],
                ),
                borderRadius: 8,
                onTap: () {

                  NavigatorUtils.push(
                    context,
                    '${XUserRouter.userUseAuth}',
                  );

                },
              ),

              ItemView(
                width: 400,
                height: 50,
                leftPadding: 10,
                rightPadding: 20,
                leftWidget: Row(
                  children: [
                    const SizedBox(width: 10),
                    Text(
                      AppLocale.text('my_yonghuyinsixieyi'),
                      style: TextStyle(
                          fontSize: 15.0,
                          color: Colors.black
                      ),
                    ),
                  ],
                ),
                borderRadius: 8,
                onTap: () {

                  NavigatorUtils.push(
                    context,
                    '${XUserRouter.userHideAuth}',
                  );

                },
              ),



            ],
          )
      ),
    );
  }

}



























